package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysAppointmentSlotMapper;
import com.ruoyi.system.domain.SysAppointmentSlot;
import com.ruoyi.system.service.ISysAppointmentSlotService;

/**
 * 医生可预约号源Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-09
 */
@Service
public class SysAppointmentSlotServiceImpl implements ISysAppointmentSlotService 
{
    @Autowired
    private SysAppointmentSlotMapper sysAppointmentSlotMapper;

    /**
     * 查询医生可预约号源
     * 
     * @param slotId 医生可预约号源主键
     * @return 医生可预约号源
     */
    @Override
    public SysAppointmentSlot selectSysAppointmentSlotBySlotId(Long slotId)
    {
        return sysAppointmentSlotMapper.selectSysAppointmentSlotBySlotId(slotId);
    }

    /**
     * 查询医生可预约号源列表
     * 
     * @param sysAppointmentSlot 医生可预约号源
     * @return 医生可预约号源
     */
    @Override
    public List<SysAppointmentSlot> selectSysAppointmentSlotList(SysAppointmentSlot sysAppointmentSlot)
    {
        return sysAppointmentSlotMapper.selectSysAppointmentSlotList(sysAppointmentSlot);
    }

    /**
     * 新增医生可预约号源
     * 
     * @param sysAppointmentSlot 医生可预约号源
     * @return 结果
     */
    @Override
    public int insertSysAppointmentSlot(SysAppointmentSlot sysAppointmentSlot)
    {
        sysAppointmentSlot.setCreateTime(DateUtils.getNowDate());
        return sysAppointmentSlotMapper.insertSysAppointmentSlot(sysAppointmentSlot);
    }

    /**
     * 修改医生可预约号源
     * 
     * @param sysAppointmentSlot 医生可预约号源
     * @return 结果
     */
    @Override
    public int updateSysAppointmentSlot(SysAppointmentSlot sysAppointmentSlot)
    {
        sysAppointmentSlot.setUpdateTime(DateUtils.getNowDate());
        return sysAppointmentSlotMapper.updateSysAppointmentSlot(sysAppointmentSlot);
    }

    /**
     * 批量删除医生可预约号源
     * 
     * @param slotIds 需要删除的医生可预约号源主键
     * @return 结果
     */
    @Override
    public int deleteSysAppointmentSlotBySlotIds(Long[] slotIds)
    {
        return sysAppointmentSlotMapper.deleteSysAppointmentSlotBySlotIds(slotIds);
    }

    /**
     * 删除医生可预约号源信息
     * 
     * @param slotId 医生可预约号源主键
     * @return 结果
     */
    @Override
    public int deleteSysAppointmentSlotBySlotId(Long slotId)
    {
        return sysAppointmentSlotMapper.deleteSysAppointmentSlotBySlotId(slotId);
    }

    /**
     * 增加医生可预约号源的已预约数量
     */
    @Override
    public int incrementBookedCount(Long slotId) {
        return sysAppointmentSlotMapper.incrementBookedCount(slotId);
    }
}
